package com.msmall.community.convene.model;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.msmall.base.model.BaseObject;
import com.msmall.base.util.StringUtil;
import com.msmall.community.user.model.UserInfo;

/**
 * 用户发出的召集令；例如我当前正在黄山旅游，邀请人一起玩，或者我打算去哪
 *
 */
@Entity
@Table(name="base_user_convene")
public class Convene extends BaseObject{

	private static final long serialVersionUID = 6689471607662058132L;

	@Id
	@Column(name="convene_id")
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long conveneId;
	
	/**
	 * 召集令标题
	 */
	@Column(name="title")
	private String title;
	
	/**
	 * 召集令内容
	 */
	@Lob
	@Basic(fetch=FetchType.LAZY)
	@Column(name="content")
	private String content;
	
	@Column(name="nickname")
	private String nickname;
	/**
	 * 召集令地点
	 */
	@Column(name="sight_id")
	private Long sightId;
	/**
	 * 召集令开始时间
	 */
	@Column(name="start_date")
	@Temporal(TemporalType.TIMESTAMP)
	private Date startDate;
	
	/**
	 * 召集令结束时间
	 */
	@Column(name="end_date")
	@Temporal(TemporalType.TIMESTAMP)
	private Date endDate;
	
	@Column(name="enabled")
	private Short enabled;
	
	@Column(name="create_time")
	@Temporal(TemporalType.TIMESTAMP)
	private Date createTime;
	
	/**
	 * 发起人
	 */
	@ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE},fetch=FetchType.LAZY)
	@JoinColumn(name="user_id")
	private UserInfo user;
	
	public Long getConveneId() {
		return conveneId;
	}

	public void setConveneId(Long conveneId) {
		this.conveneId = conveneId;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Long getSightId() {
		return sightId;
	}

	public void setSightId(Long sightId) {
		this.sightId = sightId;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public Short getEnabled() {
		return enabled;
	}

	public void setEnabled(Short enabled) {
		this.enabled = enabled;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public UserInfo getUser() {
		return user;
	}

	public void setUser(UserInfo user) {
		this.user = user;
	}

	public String getHtmlTitle(){
		return StringUtil.getChineseSubString(title, 25, "…");
	}
	@Override
	public boolean equals(Object o) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return null;
	}

}
